package class27;

/**
 * @author zhangchaoliang
 * create 2022
 */
public class ArrayOfMax {

    public static int arrayOfMax(int[] arr){
        int n = arr.length;
        int max = arr[0];
        for (int i = 1;i<n;i++){
            max = Math.max(arr[i],max);
        }
        int temp = arr[0] > arr[n-1]?arr[n-1]:arr[0];
        return max - temp;
    }
}
